export enum RandomTestingPageType {
  InterviewQuestions /* 普通试题页面 */,
  DonePage /* 已完成所以试题页面 */,
  ErrorPage /* 错误页面 */,
}

const localStorageId = 'RandomTesting'
export const RandomTestingConstants = {
  localStorageId: {
    DoneQuestionMap: `${localStorageId}:DoneQuestionMap`,
    TestType: `${localStorageId}:TestType`,
    ClassificationCode: `${localStorageId}:ClassificationCode`,
    ClassificationType: `${localStorageId}:ClassificationType`,
    PassedIdList: `${localStorageId}:PassedIdList`,
    QuestionIdList: `${localStorageId}:QuestionIdList`,
    QuestionTotal: `${localStorageId}:QuestionTotal`,
    QuestionCurrentIndex: `${localStorageId}:QuestionCurrentIndex`,
    QuestionPageSize: `${localStorageId}:QuestionPageSize`,
    QuestionPageIndex: `${localStorageId}:QuestionPageIndex`,
    titleFontSize: `${localStorageId}:titleFontSize`,
    titleFontWeight: `${localStorageId}:titleFontWeight`,
    answerFontSize: `${localStorageId}:answerFontSize`,
    answerFontWeight: `${localStorageId}:answerFontWeight`,
  },
}

export enum TestTypeKey {
  All = 'All',
  NotDone = 'NotDone',
  Done = 'Done',
}

export const TestTypeLabel = {
  [TestTypeKey.All]: '所有',
  [TestTypeKey.NotDone]: '未通过',
  [TestTypeKey.Done]: '已通过',
}

export const TestTypeList = [
  { key: TestTypeKey.All, label: TestTypeLabel[TestTypeKey.All] },
  { key: TestTypeKey.NotDone, label: TestTypeLabel[TestTypeKey.NotDone] },
  { key: TestTypeKey.Done, label: TestTypeLabel[TestTypeKey.Done] },
]

export const getTestTypeKeyByStr = (str: string | undefined | null) => {
  if (!str) return
  switch (str) {
    case TestTypeKey.All: {
      return TestTypeKey.All
    }
    case TestTypeKey.NotDone: {
      return TestTypeKey.NotDone
    }
    case TestTypeKey.Done: {
      return TestTypeKey.Done
    }
  }
}
